import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Test from '@/pages/Test'
import Detail from '@/pages/Detail'
import ShopCart from '@/pages/ShopCart'
import AddCartSuccess from '@/pages/AddCartSuccess'

export default [
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/shopcart',
    component: ShopCart,
  },
  {
    path: '/addcart_success',
    component: AddCartSuccess,
    name: 'addcartSuccess',
  },
  {
    path: '/detail/:goodsId',
    component: Detail,
  },
  {
    path: '/test',
    component: Test,
  },
  {
    path: '/login',
    component: Login,
    meta: {
      isHidden: true,
    },
  },
  {
    path: '/register',
    component: Register,
    meta: {
      isHidden: true,
    },
  },
  {
    path: '/search/:keyword?',
    component: Search,
    name: 'search',
    props: (route) => ({ ...route.params, ...route.query }),
    // props(route) {
    //   return {
    //     name: 'search',
    //     params: { keyword: route.content },
    //     query: { content: route.content },
    //   }
    // },
  },
  {
    path: '/',
    redirect: '/home',
  },
]
